import { auth } from '@/lib/auth';
import type { NextRequest } from 'next/server';

export async function GET(request: NextRequest) {
  try {
    const session = await auth.api.getSession({
      headers: request.headers,
    });
    return new Response(JSON.stringify(session));
  } catch (error: any) {
    return new Response(error.message ?? 'internal server error');
  }
}
